import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../http/api.dart';
import '../main.dart';

class PrintingDialog{


  show(callback){
    if(Get.isDialogOpen != null && Get.isDialogOpen!){
      Get.back();
    }
    Get.defaultDialog(
      title: "",
      barrierDismissible: false,
      contentPadding:EdgeInsets.zero,
      titlePadding:EdgeInsets.zero,
      backgroundColor: Colors.transparent,
      content: Container(
          width: 300.w,
          height: 267.h,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(8.r)),
          ),
          child: Stack(
            alignment: AlignmentDirectional.center,
            children: [
              Image.asset("assets/images/print_bg.png",width: 250.w,fit: BoxFit.fitWidth,),

              Positioned(
                right: 15.w,
                top: 10.h,
                child:  InkWell(
                  onTap: (){
                    currentTask.clear();
                    timer.cancel();
                    Get.until((route) => route.isFirst);
                  },
                  child: Image.asset("assets/images/close.png",width: 12.w,fit: BoxFit.fitWidth,),
              )),
              Positioned(
                bottom:20.h,
                child:Row(
                  children: [
                    InkWell(
                      onTap: (){
                        currentTask.clear();
                        timer.cancel();
                        Get.until((route) => route.isFirst);
                      },
                      child: Image.asset("assets/images/cancel.png",width: 60.w,fit: BoxFit.fitWidth,),
                    ),
                    SizedBox(width: 20.w,),
                    InkWell(
                      onTap: (){
                        // final uid = currentTask.uid;
                        // final uName = currentTask.uName;
                        callback();

                      },
                      child: Image.asset("assets/images/print.png",width: 60.w,fit: BoxFit.fitWidth,),
                    ),
                  ],
                )
              )
            ],
          )
      ),
    );
  }
}